using Godot;

public class FurnaceView : StoreView
{
    Slot input, fuel, output;
    TextureProgress textureProgress;
    public override void _Ready()
    {
        base._Ready();
        ResetShiftClick();
        textureProgress = GetNode<TextureProgress>("TextureProgress");
        input = GetNode<Slot>("Input");
        input.index = 0;
        input.OnClickEvent = ClickSlot;
        input.OnShiftClickEvent = ShiftClickSlot;
        input.HoldIn = BlockHoldIn;
        input.HoldOver = HoldOver;
        fuel = GetNode<Slot>("Fuel");
        fuel.index = 1;
        fuel.OnClickEvent = ClickSlot;
        fuel.OnShiftClickEvent = ShiftClickSlot;
        fuel.HoldIn = BlockHoldIn;
        fuel.HoldOver = HoldOver;
        output = GetNode<Slot>("Output");
        output.index = 2;
        output.OnClickEvent = ClickSlot;
        output.OnShiftClickEvent = ShiftClickSlot;
        output.HoldIn = BlockHoldIn;
        output.HoldOver = HoldOver;
    }
    public override void Create()
    {
        base.Create();
    }

    public override void Updata(Player player)
    {
        base.Updata(player);
        if (block != null)
        {
            FurnaceBlockEntity fbe = (FurnaceBlockEntity)block.blockEntity;
            input.SetItemStack(fbe.store.GetItemStack(0));
            fuel.SetItemStack(fbe.store.GetItemStack(1));
            output.SetItemStack(fbe.store.GetItemStack(2));
            textureProgress.Value = ((float)fbe.Pace / (float)FurnaceBlockEntity.MaxPace) * 100f;
        }
    }
}
